package com.ruoyi.web.controller.common;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.service.IMinioService;
import com.ruoyi.web.service.IUploadService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * app通用请求处理
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/app/common")
public class CommonAppController {
    @Resource
    private IUploadService uploadService;

    @Resource
    private IMinioService minioService;

    @ApiOperation("查询文件分片上传配置接口")
    @GetMapping("/uploadConfigByApp")
    public AjaxResult uploadConfigByApp() {
        return uploadService.uploadConfigByApp();

    }

    @ApiOperation("文件上传（不分片")
    @PostMapping("/uploadMinio")
    public AjaxResult uploadFileMinio(MultipartFile file) throws Exception {
        return minioService.uploadMinio(file);

    }
}
